import React, { Component,Fragment } from 'react';
// 引入

import HeaderX from '../components/home/header'
import ClassnavX from '../components/home/class_nav'
import NearfoodX from '../components/home/nearfood'
import GlassX from '../components/home/glass_x'

class Home extends Component {
    constructor(){
      super()
      this.state={
        d_info:'',
        flag_x:true
      }
    }
    componentWillMount(){
       this.setState({
            d_info:this.props.match.params.dress_x,
            
          })
        setTimeout(()=>{
          this.setState({
            flag_x:false
          })
        },800)
    }
    render() {
      console.log(this.props.location.state.d_info)
      let toheader=''
    //   if(Object.keys(this.state.d_info)===false){
    //     console.log("这是个空对象")
    //     toheader=null
    // }else{
      toheader=this.props.location.state.d_info
    //     //  console.log(this.state.d_info)
    // }
      return (
       <Fragment>
            <HeaderX d_info={toheader}/>
            <ClassnavX/>
            <NearfoodX/>
            <GlassX toglass={this.state.flag_x}/>
       </Fragment>
      );
    }
  }
  export default Home
